<template>
    <div>
        <h3>这是新闻详情页--{{id}}</h3>
        <h2>{{infoList.title}}</h2>
        <h4>摘要：{{infoList.zhaiyao}}</h4>
        <p>{{infoList.content}}</p>
        <img :src="infoList.img_url" alt="">

        <comment-box :id="id"> </comment-box>
    </div>
</template>

<script>
    import comment from '../subcomponents/comment.vue'
    export default {
        data() {
            return {
                id:this.$route.params.id,
                infoList:[]
            }
        },
        created(){
            this.getNewsInfo();
            // console.log('1');
            
        },
        methods:{
            getNewsInfo(){
                // console.log('2');
                
                this.$http.get('http://localhost:5000/api/getnew/'+this.id).then(data=>{
                    console.log(data.body.message);
                    this.infoList = data.body.message;
                })
            }
        },
        components:{
            "comment-box":comment
        }

    }

</script>

<style>

</style>
